package com.maxjay.component.metadata.web.controller;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.maxjay.common.exception.ERR;
import com.maxjay.common.exception.GeneException;

public abstract class BaseServlet extends HttpServlet {
	
	private static final long serialVersionUID = 1L;
	
	private static final Logger LOG = Logger.getLogger(BaseServlet.class);
       
    public BaseServlet() {
        super();
    }

    protected void outputJsonStream(HttpServletResponse response, String msg){
		try {
			response.setCharacterEncoding("UTF-8");
			response.setContentType("application/x-json");
			response.getWriter().write(msg);
		} catch (Exception e) {
			e.printStackTrace();
			LOG.error(e.getMessage(), e);
			throw GeneException.getGeneException(ERR.ERROR_ERR_MSG, e);
		}
	}
}
